[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+--------+#################################################################
#+-| M_OPEN |---------------------------------------------------------+#######
#| +--------+ Opens memo_field for reading, writing or appending text |#######
#+--------------------------------------------------------------------+#######
##############################################################################
##############################################################################
#+--| Summary |--------------+################################################
#| #INCLUDE memo.hdr |################################################
#+---------------------------+################################################
##############################################################################
##############################################################################
#+--| Syntax |----------------------------------------------+#################
#| PROCEDURE m_open PROTOTYPE |#################
#| PARAMETERS MEMO memo_field, VALUE INT memo_mode |#################
#+----------------------------------------------------------+#################
##############################################################################
##############################################################################
#######+---| Description |--------------------------------------------+#######
#######| The m_open procedure opens memo_field for reading, writing |#######
#######| or appending text. |#######
#######| ------------------------------------------------------------ |#######
#######| The memo_mode parameter establishes access rights for |#######
#######| memo_field: read only, memo creation or appending. The |#######
#######| memo is assumed to be in ASCII text with lines terminating |#######
#######| in carriage return and line-feed characters. |#######
#######| ------------------------------------------------------------ |#######
#######| The m_open procedure uses a DOS file handle. The m_close |#######
#######| function closes the memo and returns the handle to DOS. |#######
#######| ------------------------------------------------------------ |#######
#######| FORCE library supports up to 255 open files at one time. |#######
#######| Use more_handles to allocate DOS file handles. |#######
#######+--------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Copy a memo field from one record to another, |#########
#########| * e.g., copy from rec_num1 to rec_num2. |#########
#########| |#########
#########| PROCEDURE copy_memo |#########
#########| PARAMETERS ALIAS cur_database; |#########
#########| MEMO source; |#########
#########| MEMO dest; |#########
#########| VALUE LONG rec_num1; |#########
#########| VALUE LONG rec_num2; |#########
#########| CHAR copy_buffer |#########
#########| |#########
#########| *--- open both memo fields for copying |#########
#########| |#########
#########| m_open( source, &M_READ ) |#########
#########| m_open( dest, &M_APPEND ) |#########
#########| |#########
#########| *--- copy loop. GOTO source record, get a line. |#########
#########| *--- GOTO dest record, write a line. |#########
#########| |#########
#########| DO WHILE .NOT. m_eof( source ) |#########
#########| !cur_database GOTO rec_num1 |#########
#########| m_getln( source, copy_buffer ) |#########
#########| !cur_database GOTO rec_num2 |#########
#########| m_putlin( dest, copy_buffer ) |#########
#########| ENDDO |#########
#########| |#########
#########| m_close( source ) |#########
#########| m_close( dest ) |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * If a database has several memos, each may |#########
#########| * open at the same time. |#########
#########| |#########
#########| DBFDEF z |#########
#########| MEMO m1 |#########
#########| MEMO m2 |#########
#########| MEMO m3 |#########
#########| ENDDEF |#########
#########| {...} |#########
#########| m_open( z->m1, &M_APPEND ) && for appending lines. |#########
#########| m_open( z->m2, &M_CREATE ) && if memo exists, |#########
#########| && it's truncated. |#########
#########| m_open( z->m3, &M_READ ) && can NOT put line |#########
#########| && into memo via m_put. |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
m_close
m_edit
m_eof()
m_exist()
m_getln
...
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson